Skip to content

[backport] Backport sweep for 9.1#4225

Open
valkeyrie-ops[bot] wants to merge 3 commits into
9.1from
agent/backport/sweep/9.1
Open

[backport] Backport sweep for 9.1#4225
valkeyrie-ops[bot] wants to merge 3 commits into
9.1from
agent/backport/sweep/9.1

Conversation

@valkeyrie-ops

@valkeyrie-ops valkeyrie-ops Bot commented Jul 20, 2026

Copy link
Copy Markdown

Backport sweep for 9.1

Automated cherry-picks from PRs marked "To be backported".

Applied

Source PR Title Detail
#4104 Avoid offloading writes to IO threads for the slot migration export job while snapshotting. conflicts resolved by Claude Code
#4229 Validate slot import ranges when loading from RDB
#4210 Check and reject invalid slot import job names

AI resolution details are posted as comments on this PR when available.


Generated by valkey-ci-agent using Claude Code.

@valkeyrie-ops valkeyrie-ops Bot added ai-resolved-conflicts AI is used to resolve conflicts in automated backport PRs. backport Backport PR opened by valkey-ci-agent labels Jul 20, 2026
@valkeyrie-ops

valkeyrie-ops Bot commented Jul 20, 2026

Copy link
Copy Markdown
Author

AI conflict resolution: source PR #4104

Avoid offloading writes to IO threads for the slot migration export job while snapshotting.

1 conflicted file

Claude Summary

Both conflicts are resolved and the result matches the upstream PR exactly in size and shape (28 insertions, 9 deletions across the same 3 files). I did not run git add, per the constraints, so the test file still shows as unmerged in git status — but its contents are fully resolved with no conflict markers.

What I did:

  • tests/unit/cluster/cluster-migrateslots.tcl — Both conflicts were on start_cluster header lines for the two slot-migration-max-failover-repl-bytes test blocks. The PR's only change to those lines was adding the network tag; the repl-timeout 3600 override on the incoming side came from an unrelated upstream commit that isn't on the 9.1 branch. I merged by adding just the network tag while keeping 9.1's existing overrides (no repl-timeout 3600), consistent with the other seven start_cluster headers that auto-merged cleanly with only the tag added.

  • src/cluster_migrateslots.c and src/io_threads.c — Auto-merged identically to the upstream diff (skip SIGUSR1 when the child exit pipe is closed, defer snapshotting while client IO state isn't idle, and skip IO-thread write offload for slot-migration export clients). No adaptation needed.

Verification: I confirmed all symbols the new code relies on exist on 9.1 (clusterSlotMigrationShouldInstallWriteHandler, slot_migration_child_exit_pipe, io_read_state/io_write_state, CLIENT_IDLE, and the network tag which is recognized in test_helper.tcl and already used by other test files). Both C files pass gcc -fsyntax-only, and no conflict markers remain in any of the three files.

AI-resolved conflicted files

  • tests/unit/cluster/cluster-migrateslots.tclview diff

Full backport commit diff: commit 270c167226a6.

Please review these AI resolutions for correctness before merging.

@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.72%. Comparing base (d27f9ba) to head (abd8e4a).

Files with missing lines Patch % Lines
src/cluster_migrateslots.c 84.61% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              9.1    #4225      +/-   ##
==========================================
+ Coverage   76.67%   76.72%   +0.04%     
==========================================
  Files         163      163              
  Lines       81286    81302      +16     
==========================================
+ Hits        62330    62376      +46     
+ Misses      18956    18926      -30     
Files with missing lines Coverage Δ
src/io_threads.c 76.09% <100.00%> (+0.05%) ⬆️
src/kvstore.c 96.65% <100.00%> (ø)
src/valkey-check-rdb.c 71.48% <100.00%> (+0.60%) ⬆️
src/cluster_migrateslots.c 92.36% <84.61%> (+0.21%) ⬆️

... and 26 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

satheeshaGowda and others added 3 commits July 22, 2026 09:48
…ob while snapshotting. (#4104)

**Problem Description**

Atomic slot migration is failing when io-threads enabled and pipeline
requests are ongoing

```== CRITICAL == This slot-import-target is sending an error to its slot-import-source: 'Protocol error: invalid CRLF in request' after processing the command 'set'```

**Proposed Fix**
 Disable I/O threads offloading for slot migration jobs when snapshotting to prevent query buffer desynchronization during pipelining

Signed-off-by: Satheesha Gowda <satheesha.balaji@gmail.com>
When loading slot migration import jobs from the RDB, the start and
end slots of each range were not validated. A corrupted or truncated
RDB could produce out-of-range slot values or a reversed range
(start > end), which would then be used to build migration jobs and
slot ranges.

Reject any slot import range whose start or end slot is greater than
or equal to CLUSTER_SLOTS, or whose start slot is greater than the
end slot, logging a warning and aborting the load.

Fixes #4222.

Signed-off-by: Binbin <binloveplay1314@qq.com>
## Summary
- `clusterRDBLoadSlotImport()` accepted a variable-length `job_name`
from RDB, but `createSlotImportJob()` always `memcpy`'s
`CLUSTER_NAMELEN` (40) bytes. A crafted RDB with a shorter name caused a
heap out-of-bounds read during startup.
- Reject slot-import records whose `job_name` length is not exactly
`CLUSTER_NAMELEN`, matching the existing command-path check.
- Add an integration test that crafts a short `job_name` RDB and asserts
the server fails closed.

Fixes #4207

## Test plan
- [x] `./runtest --single tests/integration/rdb-slot-import.tcl`

---------

Signed-off-by: quanyeyang <quanyemostima@gmail.com>
@valkeyrie-ops
valkeyrie-ops Bot force-pushed the agent/backport/sweep/9.1 branch from 66b7144 to abd8e4a Compare July 22, 2026 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-resolved-conflicts AI is used to resolve conflicts in automated backport PRs. backport Backport PR opened by valkey-ci-agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants